<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>选择导入的病例模板</title>
    <link rel="stylesheet" href="../../lib/layui/css/layui.css"/>
    <script src="../../lib/layui/layui.js"></script>
    <script src="../../js/jquery.min.js"></script>
    <script type="text/javascript" src="../../js/xadmin.js"></script>
    <script src="../../js/common.js"></script>
</head>
<body>
<div id="view"></div>
</body>
</html>
<!--单个患者病例-->
<script id="template2" type="text/html">
    <div class="layui-card layui-anim layui-anim-upbit">
        <div class="layui-card-header">{{d.pName}}</div>
        <div class="layui-card-body">
            <ul>
                <li>患者主述:{{d.pStatement}}</li>
                <li>历史病症:{{d.pPastIllness}}</li>
                <li>身体检查:{{d.pExamination}}</li>
                <li>辅助检查:{{d.pAuxiliary}}</li>
                <li>治疗意见:{{d.pIdea}}</li>
                <li>诊治时间:{{d.pDiagnosisDate}}</li>
            </ul>
        </div>
    </div>
</script>
<!--给患者病例模板导入数据-->
<script>
    $(function(){
        var id =parent.getOldCaseId();
        //根据id进行查询
        useAjax("/JT90/selectOldCase",{"id":id},"JSON","GET",function(map){
            if (map.success){
                var data = map.data;
                $("#view div").remove();
                $.each(data, function (index, item) {
                    renderOldCase(item);
                })
            }else{
                if (map.message!=null){
                    layer.msg(map.message);
                }else{
                    layer.msg("查询失败",{icon:5});
                }
            }
        })
    })
    //根据id查询患者历史病例
    function renderOldCase(data){
        layui.use("laytpl",function(){
            var laytpl=layui.laytpl;	             //获取laytpl操作对象
            var getTpl = $("#template2").html();	    //获取页面的js模板
            laytpl(getTpl).render(data, function(html){
                //     $("#view div").remove();	        //删除原有的数据
                $("#view").append(html);	          //添加新的数据
            });
        })
    }


</script>
